package com.xwb.controller;


import com.xwb.domain.Leader;
import com.xwb.service.LeaderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/leader")
public class LeaderController {

    @Autowired
    private LeaderService leaderService;

    @PostMapping
    public Result save(@RequestBody Leader leader) {
        //要生成一个队伍号设置到队长信息中

        leader.setTeamNumber("只因你太美比赛1号");
        boolean flag = leaderService.saveLeader(leader);
        return new Result(flag ? Code.SAVE_OK : Code.SAVE_ERR, flag);
    }


}
